package com.fengye.school.model.school;


import com.fengye.school.model.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Set;

@Table(name = "tb_s_class")
@org.hibernate.annotations.Table(appliesTo = "tb_s_class", comment = "班级")
@Entity
@Getter
@Setter
public class EClass extends BaseEntity {

    @Column(name = "name", columnDefinition = "varchar(255) comment '班级名称,如自动化56班'")
    private String name;


    @OneToMany(fetch = FetchType.LAZY, mappedBy = "eClass", targetEntity = Student.class)
    public Set<Student> students;

    /**
     * 班主任
     */
    @OneToOne
    @JoinColumn(name = "teacher_id", columnDefinition = "bigint comment '班主任id'")
    public Teacher teacher;

    /**
     * 专业
     */
    @ManyToOne
    @JoinColumn(name = "major_id", columnDefinition = "bigint comment '专业id'")
    public Major major;

    @ManyToOne
    @JoinColumn(name = "grade_id", columnDefinition = "bigint comment '年级id'")
    public Grade grade;


}
